﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VideoNetApplication.Common;
using VideoNetApplication.Common.Helper;
using VideoNetApplication.Common.Service;

namespace VideoNetApplication
{
    public partial class ViewNewsDetail : BasePage
    {
        private int nid = 0;
        public V_News news;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["nid"] != null && StringUtils.IsNumeric(Request["nid"]))
            {
                nid = Convert.ToInt32(Request["nid"]);
            }
            GetNewsDetail();
        }

        public void GetNewsDetail()
        {
            var newsService = new NewsService();
              news = newsService.GetNewsById(nid);
              if (news != null)
              {
                  ltrAuthor.Text = string.IsNullOrEmpty(news.NewsAuthor) ? "佚名" : news.NewsAuthor;
                  ltrUptime.Text = DateTime.Parse(news.UpdateTime.ToString()).ToString("yyyy-MM-dd");
                  ltrContent.Text = news.NewsContent;
                  ltrTitle.Text = news.NewsTitle;
              }


        }
    }
}
